from fastapi import FastAPI, Request
from fastapi.templating import Jinja2Templates

app = FastAPI()

# 模板目录
templates = Jinja2Templates(directory="templates")


@app.get("/html/{data}")
async def read_html(request: Request, data: str):
    return templates.TemplateResponse("index.html", {"request": request, "data": data})
